/*
 * @Author: White
 * @description: 路由
 * @LastEditTime: 2021-09-01 11:09:10
 */

import { createRouter, createWebHashHistory } from 'vue-router'
import { lazyLoad } from '@/utils/index'

const routes = [
  { path: '/', component: lazyLoad('Index') },
  { path: '/leave', component: lazyLoad('Leave') },
  { path: '/article', component: lazyLoad('EditArticle') },
  { path: '/DetailArticle', component: lazyLoad('DetailArticle') },
  { path: '/music',
    // 网易云模块
    component: lazyLoad('Music'),
    children: [
      { path: '/music', component: lazyLoad('Musicpage/Index') },
      // 搜索页
      { path: '/music/search', component: lazyLoad('Musicpage/Search') },
      // 歌单
      { path: '/music/songlist', component: lazyLoad('Musicpage/SongList') },
      // 排行榜
      { path: '/music/rank', component: lazyLoad('Musicpage/Rank') },
      // 歌手
      { path: '/music/singer', component: lazyLoad('Musicpage/Singer') },
      // 最新音乐
      { path: '/music/newmusic', component: lazyLoad('Musicpage/NewMusic') },
      // 歌单详情
      { path: '/music/songListdetail/:id', name: "songListdetail", component: lazyLoad('Musicpage/SongListdetail') }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})

export default router
